/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ontologia.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Sebastian Rojas
 */
@Entity
@Table(name = "paquetes", catalog = "ontologia", schema = "")
@XmlRootElement
@NamedQueries({
  @NamedQuery(name = "Paquetes.findAll", query = "SELECT p FROM Paquetes p"),
  @NamedQuery(name = "Paquetes.findById", query = "SELECT p FROM Paquetes p WHERE p.id = :id"),
  @NamedQuery(name = "Paquetes.findByPeso", query = "SELECT p FROM Paquetes p WHERE p.peso = :peso"),
  @NamedQuery(name = "Paquetes.findByMaxPeso", query = "SELECT MAX(p.peso) FROM Paquetes p"),
  @NamedQuery(name = "Paquetes.findByMinPeso", query = "SELECT MIN(p.peso) FROM Paquetes p"),
  @NamedQuery(name = "Paquetes.findByTamano", query = "SELECT p FROM Paquetes p WHERE p.tamano = :tamano"),
  @NamedQuery(name = "Paquetes.findByMaxTamano", query = "SELECT MAX(p.tamano) FROM Paquetes p "),
  @NamedQuery(name = "Paquetes.findByMinTamano", query = "SELECT MAX(p.tamano) FROM Paquetes p ")
})
public class Paquetes implements Serializable {
  private static final long serialVersionUID = 1L;
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Basic(optional = false)
  @Column(name = "id")
  private Integer id;
  @Column(name = "peso")
  private Integer peso;
  @Column(name = "tamano")
  private Integer tamano;
  @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPaquete", fetch = FetchType.LAZY)
  private List<Ordenestrabajo> ordenestrabajoList;

  public Paquetes() {
  }

  public Paquetes(Integer id) {
    this.id = id;
  }

  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public Integer getPeso() {
    return peso;
  }

  public void setPeso(Integer peso) {
    this.peso = peso;
  }

  public Integer getTamano() {
    return tamano;
  }

  public void setTamano(Integer tamano) {
    this.tamano = tamano;
  }

  @XmlTransient
  public List<Ordenestrabajo> getOrdenestrabajoList() {
    return ordenestrabajoList;
  }

  public void setOrdenestrabajoList(List<Ordenestrabajo> ordenestrabajoList) {
    this.ordenestrabajoList = ordenestrabajoList;
  }

  @Override
  public int hashCode() {
    int hash = 0;
    hash += (id != null ? id.hashCode() : 0);
    return hash;
  }

  @Override
  public boolean equals(Object object) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if (!(object instanceof Paquetes)) {
      return false;
    }
    Paquetes other = (Paquetes) object;
    if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "com.ontologia.entities.Paquetes[ id=" + id + " ]";
  }
  
}
